#include<bits/stdc++.h>
using namespace std;
int main()
{
	int T;
	while (cin >> T) {
		int n, m, c;
		cin >> n >> m >> c;
		int arr[n][m] = {0};
		int x, y;
		for (int i = 1; i <= c; i++) {
			cin >> x >> y;
			arr[x-1][y-1] = 1;
		}
		int res = 0;
		for(int i=0;i<0;i++){
			for(int i=0;i<0;i++){
				
			}
		}
	}
	return 0;
}
//date : 230714
//time : s 17:00 e1:17:02  s2:17:11  e2:

